package com.jl.card.parse.part;

import opencard.opt.util.TLV;
import opencard.opt.util.Tag;

import com.jl.card.parse.IAPDUComponent;
import com.jl.card.parse.TagConstants;
import com.jl.util.HexUtil;

public class TLVPart extends APDUPart {

	private TLV tlv;
	private Tag tag;
	
	public TLVPart(IAPDUComponent parent, byte[] part) {
		super(parent, part);
		tlv = new TLV(part);
		tag = this.tlv.tag();
		analyse();
	}

	@Override
	public void analyse() {
		
	}

	@Override
	public String getSummary() {
		StringBuilder sb = new StringBuilder();
		sb.append(HexUtil.toHexCompact(tag.getBytes(), 0, tag.size()));
		sb.append('[');
		sb.append(TagConstants.getTagName(tag)).append(']');
		return sb.toString();
	}

}
